<?php

namespace fastflow\driver\think;

use think\Db;
use fastflow\driver\interfaces\logTemplate;

class log implements logTemplate
{
    
    public static function getThreadLog($param)
    {
        if (isset($param)) {
            $process = Db::table('__FASTFLOW_THREAD_LOG__')->where($param)->select();
            if (count($process) == 0) {
                return 0;
            }
            return $process;
        }
        return false;
    }

    
    public static function setThreadLog($param)
    {
        if (isset($param)) {
            $count = Db::table('__FASTFLOW_THREAD_LOG__')->update($param);
            return $count;
        }
        return false;
    }

    
    public static function addThreadLog($param)
    {
        if (isset($param)) {
            $id = Db::table('__FASTFLOW_THREAD_LOG__')->insertGetId($param);
            return $id;
        }
        return false;
    }

    
    public static function addConditionLog($param){
        if (isset($param)) {
            $id = Db::table('__FASTFLOW_CONDITION_LOG__')->insertGetId($param);
            return $id;
        }
        return false;
    }

    
    public static function getConditionLog($param)
    {
        if (isset($param)) {
            $process = Db::table('__FASTFLOW_CONDITION_LOG__')->where($param)->select();
            if (count($process) == 0) {
                return 0;
            }
            return $process;
        }
        return false;
    }

    
    public static function setConditionLog($param)
    {
        if (isset($param)) {
            $count = Db::table('__FASTFLOW_CONDITION_LOG__')->update($param);
            return $count;
        }
        return false;
    }
}